import logging
from flask import session
from flask_script import Manager
from flask_migrate import MigrateCommand, Migrate
from info import create_app, db, models


app=create_app("development")
# class Config(object):
#     DEBUG = True
#     SECRET_KEY = "DdFe6VQqPdaZAVypl5sX8MMGulcMezgSqYn+37YDnAuz5tVBjBP4NyARlE2Ta6/8"
#
#     SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information27"
#     SQLALCHEMY_TRACK_MODIFICATIONS = False
#     REDIS_HOST = "127.0.0.1"
#     REDIS_PORT = 6379
#
#     SESSION_TYPE = "redis"  # 指定 session 保存到 redis 中
#     SESSION_USE_SIGNER = True  # 让 cookie 中的 session_id 被加密签名处理
#     SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)  # 使用 redis 的实例
#     SESSION_PERMANENT = False
#     PERMANENT_SESSION_LIFETIME = 86400 * 2  # session 的有效期，单位是秒


# app = Flask(__name__)
# app.config.from_object(Config)
# db = SQLAlchemy(app)
# redis_store = StrictRedis(host=Config.REDIS_HOST, port=Config.REDIS_PORT)
# CSRFProtect(app)
# Session(app)

manager = Manager(app)
Migrate(app, db)
manager.add_command('db', MigrateCommand)

# @app.route("/")
# def index():
#     session['name'] = 'sx'
#     logging.debug("This is a debug log.")
#     logging.info("This is a info log.")
#     logging.warning("This is a warning log.")
#     logging.error("This is a error log.")
#
#     return "hellk word"

if __name__ == '__main__':
    manager.run()